var oUl = document.querySelector('#navUl')
var oLis = document.querySelectorAll('#navUl li')

for (let i = 0; i < oLis.length; i++) {
    oLis[i].index = i;
    oLis[i].setAttribute('myindex', i);

    oLis[i].onclick = function () {
        for (var j = 0; j < oLis.length; j++) {
            oLis[j].className = '';
        }
        this.className = 'active'
        console.log('我是第' + this.index)
        console.log(i)


        var boxs = document.querySelectorAll('.box')
        var box = boxs[this.index] //按钮对应的div

        for (var j = 0; j < boxs.length; j++) {
            boxs[j].style.display = 'none';
        }
        box.style.display = 'block';
    }
}